home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: December 9, 1996
- // Author: DSW
- //
- // Description:
- // Project Viewer.
- // Performs standard file operations such as Open, Save, Import, etc.
- //
- // Input Arguments:
- // String The action requested.
- // Open, Import, Reference, SaveAs,
- // ExportAll, ExportActive
- //
- // Return Value:
- // None.
- //
-
- //
- // Globals used by the browser.
- //
- global string $gv_operationMode;
- global string $gFileOptionsString;
-
-
- // Callback procs.
- //
-
- // pv_performAction moved to its own mel file.
-
- proc string[] pv_ActionSetup ( string $newAction )
- //
- // Description:
- // This proc sets up the viewer to perform the action specified when the
- // action button is pressed by the user.
- //
- {
- global string $gv_operationMode;
-
- string $saveType;
- string $readType;
- string $type[3];
- string $workspace = `workspace -fn`;
-
- $gv_operationMode = $newAction;
-
- // No option was set for the save type.
- $saveType = "mayaBinary";
-
- // No option was set for the save type.
- $readType = "Best Guess";
-
- switch ($newAction) {
- case "Open": {
- if (`optionVar -exists defaultFileOpenType`) {
- $readType = `optionVar -q defaultFileOpenType`;
- }
- $type[0] = "Open";
- $type[1] = $readType;
- $type[2] = "0";
- setWorkingDirectory $workspace $readType "scene";
- break;
- }
- case "Reference": {
- if (`optionVar -exists defaultFileReferenceType`) {
- $readType = `optionVar -q defaultFileReferenceType`;
- }
- $type[0] = "Reference";
- $type[1] = $readType;
- $type[2] = "0";
- setWorkingDirectory $workspace $readType "scene";
- break;
- }
- case "Import": {
- if (`optionVar -exists defaultFileImportType`) {
- $readType = `optionVar -q defaultFileImportType`;
- }
- $type[0] = "Import";
- $type[1] = $readType;
- $type[2] = "0";
- setWorkingDirectory $workspace $readType "scene";
- break;
- }
- case "ReplaceReference": {
- if (`optionVar -exists defaultFileReferenceType`) {
- $readType = `optionVar -q defaultFileReferenceType`;
- }
- $type[0] = "Reference";
- $type[1] = $readType;
- $type[2] = "0";
- setWorkingDirectory $workspace $readType "scene";
- break;
- }
- case "Save":
- {
- $gv_operationMode = "SaveAs";
- if (`optionVar -exists defaultFileSaveType`)
- {
- $saveType = `optionVar -q defaultFileSaveType`;
- }
- string $objectTypes[] = `workspace -q -ot`;
- int $index;
- int $mode = 1;
- int $numObjectTypes = size($objectTypes);
- for ($index = 0; $index < $numObjectTypes; $index+=2)
- {
- if ($objectTypes[$index] == "scene")
- {
- $mode = 2;
- }
- }
- $type[0] = "Save";
- $type[1] = $saveType;
- $type[2] = $mode;
- setWorkingDirectory $workspace $saveType "scene";
- break;
- }
- case "SaveAs":
- {
- if (`optionVar -exists defaultFileSaveType`)
- {
- $saveType = `optionVar -q defaultFileSaveType`;
- }
- string $objectTypes[] = `workspace -q -ot`;
- int $index;
- int $mode = 1;
- int $numObjectTypes = size($objectTypes);
- for ($index = 0; $index < $numObjectTypes; $index+=2)
- {
- if ($objectTypes[$index] == "scene")
- {
- $mode = 2;
- }
- }
- $type[0] = "Save As";
- $type[1] = $saveType;
- $type[2] = $mode;
- setWorkingDirectory $workspace $saveType "scene";
- break;
- }
- case "ExportAll": {
- if (`optionVar -exists defaultFileExportAllType`) {
- $saveType = `optionVar -q defaultFileExportAllType`;
- }
- $type[0] = "Export All";
- $type[1] = $saveType;
- $type[2] = "1";
- setWorkingDirectory $workspace $saveType "scene";
- break;
- }
- case "ExportActive": {
- if (`optionVar -exists defaultFileExportActiveType`) {
- $saveType = `optionVar -q defaultFileExportActiveType`;
- }
- $type[0] = "Export Selection";
- $type[1] = $saveType;
- $type[2] = "1";
- setWorkingDirectory $workspace $saveType "scene";
- break;
- }
- case "CreateReference": {
- if (`optionVar -exists defaultFileCreateReferenceType`) {
- $saveType = `optionVar -q defaultFileCreateReferenceType`;
- }
- $type[0] = "Reference";
- $type[1] = $saveType;
- $type[2] = "0";
- setWorkingDirectory $workspace $saveType "scene";
- break;
- }
- }
-
- return $type;
- }
-
- global proc int projectViewer ( string $startUpAction )
- //
- // Description:
- // This is the main procedure for the projectViewer.
- //
- {
- string $typeAndMode[3];
-
- $typeAndMode = `pv_ActionSetup $startUpAction`;
- fileBrowser "pv_performAction" $typeAndMode[0] $typeAndMode[1] ((int)$typeAndMode[2]);
-
- return 1;
- }
-